<template>
  <div class="gk-layout-container">
      <div class="gk-layout-header">
        <s-query perms="sys:log"   @click="findPage"  > 
          <el-form-item>
            <el-input v-model="filters.tableName"  placeholder="集合名称"></el-input>
          </el-form-item>
          <el-form-item>
            <el-input v-model="filters.info"  placeholder="日志内容"></el-input>
          </el-form-item>
        </s-query>  
      </div>


     <div class="gk-layout-main">
      <my-table :data="pageResult.content" :loading="loading" >
          <el-table-column :label="$t('action.desc')" width="50" fixed="left"  header-align="center" align="center">
            <template slot-scope="scope">   {{scope.$index+1}}   </template>
          </el-table-column> 
 
          <el-table-column   prop="info" label="日志内容"   />
          <el-table-column  width="150"    prop="time" label="时间"     :formatter="dateFormat"  />
      </my-table>
  </div>
  <!--分页栏-->
  <div class="toolbar gk-layout-footer"  style="padding:10px;">
   
    <el-pagination layout="total, prev, pager, next, jumper"  @current-change="findPage"
                   :current-page="filters.pageNum"
                   :page-size="filters.pageSize"
                   :total="pageResult.totalSize"
                   style="float:right;">
    </el-pagination>
  </div>


   
  </div>
</template>

<script>

import KtButton from "@/views/Core/KtButton"
import { format } from "@/utils/datetime"
import MyTable from "@/views/Core/MyTable"
import Column from "@/views/Core/Column"
    import SQuery from "@/components/Kj/SQuery" 
export default {
  components: {
MyTable,Column,
    KtButton,SQuery
  },
  data () {
    return {
      loading:false,
      size: global.gSize,
      filters: {
        id: '',
        info: '',
        time: '',pageNum: 1, pageSize: 200 ,
        tableName:''
      },
    
      pageResult: {},
      showOperation: false
    }
  },
  methods: {
    // 获取分页数据
    findPage: function (data) {
      if(data!=-1){
				this.filters.pageNum=data	
			}
      this.$api.wcslog.wcsFindEquipmentPage(this.filters).then((res) => {
        this.pageResult = res.data
      }) 
    },
    // 时间格式化
    dateFormat: function (row, column, cellValue, index) {
      return format(row[column.property])
    }
  },
  created(){

      var d =new Date()
      var MM=d.getMonth()+1;
      if(MM<10){
        MM="0"+MM;
      } 
      this.filters.tableName="message_log"+d.getFullYear()+MM

  },

  mounted () {

  
    this.findPage(1)
  }
}
</script>

<style scoped>
</style>